<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
  
  <head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
 	<link rel="stylesheet" href="../static/css/back/font.css">
 	<link rel="stylesheet" href="../static/css/back/role.css">
    <link rel="stylesheet" href="../static/css/back/xadmin.css">
    <script type="text/javascript" src="../static/js/jquery-2.1.1.min.js"></script>
    
    <script type="text/javascript" src="../static/js/back/xadmin.js"></script>
    <script type="text/javascript" src="../static/js/back/ajax.js"></script>
<!--     <script type="text/javascript" src="../static/js/back/shop-info.js"></script> -->
<style type="text/css">
tr th:nth-child(1),  tr td:nth-child(1) {
	border-right: 0;
}
tr th:nth-child(2) , tr td:nth-child(2) {
	border-left: 0;
}
td span {
	    position: absolute;
    right: 20px;
}
</style>
</head>
  
  <body>
  <div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="javascript:;">首页</a>
        <a href="javascript:;">门店管理</a>
        <a href="javascript:;"><cite>营业时间</cite></a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="iconfont icon-refresh right-top-ref" ></i></a>
    </div>
    <div class="x-body">
    <xblock>
        <button class="layui-btn" onclick="x_admin_show('编辑营业时间','./shops~shop-info-time-edit.html')"><i class="layui-icon"></i>编辑营业时间</button>
      </xblock>
      <table class="layui-table">
        <thead>
          <tr>
            <th>开始时间</th>
            <th>结束时间</th>
            </tr>
        </thead>
        <tbody>
        </tbody>
    </table>
    </div>
    <script>
    $(function(){
    	getList();
    })
    function getList(){
    	_ajax_post_token('../shop/getShopById',{id:getCookie('shop_id')},function(res){
    		console.log(res);
    		if(res.returnObject){
    			var tims = res.returnObject.openHours;
    			var ts = tims.split(',');
    			var html = '';
    			$('.layui-table tbody').html("");	
    			console.log(ts);
    			for (var i = 0; i < ts.length; i++) {
					html =' <tr> <td name="startTime">'
	    		 			+ ts[i].split("-")[0]
		 		 			+'</td><td name="endTime">'
		         			+ ts[i].split("-")[1]
		         			+'</td></tr>';
		 					$('.layui-table tbody').append(html);		
				}
    		}
    	});
    }
    </script>
  </body>
</html>